{% extends "howto" %}

{% block main %}
			<h2 id="building-a-subkit">Building a subkit</h2>
				<p>Kits can contain subkits, which can be either optional or loaded by their parent kit.</p>
				<p>It will also require another kit, <em>webappkit/datapath</em>, and provide an extension as an optional subkit named <em>mysubkit</em>.</p>
				<ol>
					<li>
						<p>Into <em>mykit.wak/</em>, create a folder named <strong>mysubkit.wak</strong></p>
					</li>
					<li>
						<p>Put its own code files into it, for example <strong>anotherclass.php4</strong> and <strong>anotherclass.php5</strong>, which are PHP4 and PHP5 versions of the same class as seen before.</p>
					</li>
					<li>
						<p>Create its <strong>wak.ini</strong> file at its root :</p>
						<code>[load_kits]
; kits to load before self resources, order will be preserved.
; n = "absolute kit id"
0 = "mykit"
1 = "pathnodes"

[load_files]
; self resources to load, order will be preserved.
; n = "relative/path/to/file"
0 = "anotherclass.php*"</code>
						<p>As you see, this subkit requires its parent kit and another kit, <em>pathnodes</em>.
						It also requires <em>datapath</em>, but this dependancy is already defined by parent kit.</p>

					</li>
				</ol>
				<p>A subkit may contain itself a subkit and so on.</p>
				<h3>Subkits auto-loading</h3>
				<p>If we want the parent kit <em>mykit</em> to load its subkit when loaded itself, we can add this into <em>mykit</em>'s wak.ini file :</p>
				<code>[load_subkits]
; subkits to load after self resources, order will be preserved
; n = "relative subkit id"
0 = "mysubkit"</code>
				<p>The subkit will be loaded <strong>after</strong> paren'ts kit dependancies and own files.</p>
{% endblock %}